package jmine.tec.persist.schema.embedded.field;

import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import jmine.tec.persist.annotation.Alias;
import jmine.tec.persist.schema.embedded.EmbeddedCEntity;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

import bancosys.tec.component.Documentation;
import bancosys.tec.persist.bussobj.PersistableBusinessObject;

@Entity
@Alias("EMBEDV")
@Table(name = "EMBEDVAL")
@Documentation("TABELA COM EMBEDDED DE VALUE")
@SequenceGenerator(name = "SEQ_EMBEDV", sequenceName = "SEQ_EMBEDV")
public class EntityEmbeddedValue extends PersistableBusinessObject {

    private Long id;

    private EmbeddedCEntity enbedded = new EmbeddedCEntity();

    public EntityEmbeddedValue(Long id) {
        this.id = id;
    }

    /**
     * @return the id
     */
    @Id
    @GeneratedValue(generator = "SEQ_EMBEDV")
    @Column(name = "COD_EMBEDVED", nullable = false)
    @Documentation("CODIGO")
    public Long getId() {
        return this.id;
    }

    /**
     * @return the embedded
     */
    @Embedded
    public EmbeddedCEntity getEmbedded() {
        return this.enbedded;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param embedded the embedded to set
     */
    public void setEmbedded(EmbeddedCEntity embedded) {
        this.enbedded = embedded;
    }

    @Override
    public boolean equals(Object obj) {
        return EqualsBuilder.reflectionEquals(this, obj);
    }

    @Override
    public int hashCode() {
        return HashCodeBuilder.reflectionHashCode(this);
    }

}
